<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>登录页面</title>
</head>
<script type="text/javascript" src="../assets/js/jquery-3.4.1.min.js"></script>
<style>

    html,body{height: 100%;width: 100%;margin:0;padding:0;}
    body{
        background:url(../assets/img/llnyhomepage.jpg)no-repeat;
        width:100%;
        height:100%;
        background-size:100% 100%;
        position:absolute;
        filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src='/static/assets/img/llnyhomepage.jpg');
    }

    .shuru{
        width: 20%;
        height: 30%;

        position: relative;
        left: 68.5%;
        top: 42%;
    }

#userlogin
{
    color: #FFFFFF  ;
    font-size: 25px;
}
#user{
    width: 100%;
    height: 40px;
    margin-bottom:25px;
    border-radius: 6px;
    border:none;
    border:1px solid #ccc;
    outline:none;
    text-indent:1em;

}
#pwd{
    width: 100%;
    height: 40px;
    margin-bottom:25px;
    text-indent:1em;
    border-radius: 6px;
    border:none;
    border:1px solid #ccc;
    outline:none;

}

#login{
    width: 100%;
    height: 40px;
    margin-bottom:30px;
    border-radius: 6px;
    border:none;
   /* background-color:#5EABEB;*/
    background-color:#3B8EEA;
    font-size: 20px;
    color: #FFFFFF;
    outline:none;
    cursor: pointer;
    }

</style>
<body onkeydown="keyLogin();" >
<div class="shuru"  >

        <p id="userlogin">用户登录</p>
        <input type="text" name="username" placeholder="用户名" id="user"><br>
        <input type="password" name="password" placeholder="密码"  id="pwd" ><br>
        <input type="submit" name="确定"  id="login" value="登录" >

</div>
</body>

<script type="text/javascript">

    function keyLogin(){
        if (event.keyCode==13)  //回车键的键值为13
            document.getElementById("login").click(); //调用登录按钮的登录事件
    }

    $("#login").click(function () {
        var user = $("#user").val();
        var pwd = $("#pwd").val();
        if (user != "" && pwd != "") {
            $.post("/user/login", {
                account: user,
                password: pwd,
            }, function (result) {
                if (result.success) {
                    window.location.href = "index.html";
                    return false;
                } else {
                    alert(result.errorInfo)
                }
            });
        } else {
            alert("账号和密码不能为空！")
        }
    });



</script>

</html>